package com.example.giftrecord.model;

public class BaseResponse {
    private int code;

    private String msg;

    private Object data;

    public BaseResponse(int code, String msg, Object date) {
        this.code = code;
        this.msg = msg;
        this.data = date;
    }

    public static BaseResponse success(Object data) {
        return new BaseResponse(200, "success", data);
    }

    public static BaseResponse error() {
        return new BaseResponse(500, "error", null);
    }

    public static BaseResponse errorMsg(String msg) {
        BaseResponse baseResponse = new BaseResponse();
        baseResponse.setCode(500);
        baseResponse.setMsg(msg);
        return baseResponse;
    }

    public BaseResponse() {
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object date) {
        this.data = date;
    }
}
